package deom1;

import java.io.*;

public class Test1 {
    public static void main(String[] args) {
        File file = new File("113.txt");


        try (BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(file))) {
             bufferedWriter.write("55555\n");
            bufferedWriter.write("4444\n");
            bufferedWriter.write("2222\n");
            bufferedWriter.write("3333\n");

            bufferedWriter.close() ;

        } catch (IOException e) {
            throw new RuntimeException(e);
        }

        try{
            BufferedReader reader = new BufferedReader(new FileReader(file));
             String str ;
            while((str = reader.readLine()) != null){
                System.out.println(str);
            }

        }catch(IOException e){
            throw new RuntimeException();
        }



    }
}
